Skip to content

Add option to always burn in subtitles when transcoding#4459

Merged
nielsvanvelzen merged 2 commits into
jellyfin:masterfrom
GertSallaerts:feat/always-burn-subs-transcode
Apr 20, 2026
Merged

Add option to always burn in subtitles when transcoding#4459
nielsvanvelzen merged 2 commits into
jellyfin:masterfrom
GertSallaerts:feat/always-burn-subs-transcode

Conversation

@GertSallaerts
Copy link
Copy Markdown
Contributor

Changes
Adds support for toggling the alwaysBurnInSubtitleWhenTranscoding option that was introduced to Jellyfin in 10.10.

Issues
Fixes #4399

Notes
This is a first draft, partly to check whether or not you're amenable to adding this feature at all and partly to check if it's going in the right direction.

Things I know may need work:

  • I have to double-check the whole burningSubs logic (PlaybackController and PlaybackControllerHelper) for different scenarios
  • I was wondering if you could tell me whether or not the new playback code is far enough along for me to try adding it there as well of if it's something best left for later (or never).

@nielsvanvelzen
Copy link
Copy Markdown
Member

Personally I dislike this feature because you'll lose all customization on subtitles when they are burned into the video. I'd rather look into what causes the subtitles to be out-of-sync. There's a possibility (although small) that it is already fixed in the master branch after #4455 was merged.
If we have a better understanding of what causes the sync issues and determine it is not (easily) fixable we can always look into the burning option again.

@GertSallaerts
Copy link
Copy Markdown
Contributor Author

Personally I dislike this feature because you'll lose all customization on subtitles when they are burned into the video. I'd rather look into what causes the subtitles to be out-of-sync.

To quote my comment on the related issue here:

From what I understand, subtitle sync issues during transcoding are a problem that's not easy to solve and a new option was introduced in Jellyfin 10.10 to help out people who are affected. (jellyfin/jellyfin#2547 (comment), jellyfin/jellyfin#12430).

Subtitles often have synchronization issues after video transcoding. This option allows the client to opt-in to always burn in all subtitles, preventing out-of-sync subtitles at the cost of transcoding performance.

The option is already implemented in jellyfin-web where I tested it out and (for me at least) it solved the sync issues I was seeing when transcoding.

Now, I don't know much about Jellyfin's internals, I've been using it for a bit more than a year but this is the first time I'm exploring the code. But to me it sounded like this is an issue on the server that is unlikely to get solved in the short run which is why you/they are offering this workaround. I might be wrong about that, so I'll also tag @gnattu who may be able to explain this better than I can.

I do understand and appreciate your concerns about customization on subtitles, but I do think most users would prefer losing that over not being able to understand what's being said in their videos.

If a fix for these sync issues was on the horizon, I would also want to push that through over adding a workaround, but it doesn't look like that to me. As things stand, and if it is indeed a server issue, I'd even consider this PR to be adding a missing feature to improve feature parity.

I should probably have gotten involved earlier, reporting this at least, but I would be remiss not to add I've had this problem from the day I started using Jellyfin and have just been lucky that up until now my client and network have always been capable of direct playing anything I threw at it.

There's a possibility (although small) that it is already fixed in the master branch after #4455 was merged.

No, it didn't fix this (for me), I tested if the issue was still present on master before I started on this PR.

If we have a better understanding of what causes the sync issues and determine it is not (easily) fixable we can always look into the burning option again.

Maybe @gnattu will be able to shed some light on that but if there is anything I can do in regards to testing, do please let me know.

@gnattu
Copy link
Copy Markdown
Member

gnattu commented Feb 20, 2025

It is indeed a problem that is hard to track down. Neither Emby nor Plex provided full solution to this yet. The transcoding is a very complex process and the time codes can change during that process, and sometimes it would be larger enough to make the original subtitles to look very off with the original time codes. You might even notice that the transcoded video can have a different video duration that is longer/shorter than the original one, and sometimes even the actual fps is slightly modified (like 29.97 being speeded up to 30). There are too many reasons that the time code might being altered and that is why I implemented that brute force hack as a workaround.

Is it bad? Yes. And the way it is implemented is also very hacky. Because we don't have a good API to determine the actual playback method before the playback has started (the one returns before the playback does not differ transcode and remux and both will be reported as remux), the is transcoding is detected after the playback has started using the api to check for playback stats, and then determine should the client load the subtitle or not to prevent double-subtitles.

@jellyfin-bot jellyfin-bot added the merge conflict Conflicts prevent merging label Feb 24, 2025
@johnpc
Copy link
Copy Markdown
Contributor

johnpc commented Mar 31, 2025

Allowing burn-in subtitles when transcoding would also help mitigate this problem, since the burned in subtitles don't overlap like exoplayer does: #4522

@PilotFlying
Copy link
Copy Markdown

The option would be useful even when transcoding is for audio only (TV app: subtitles will go out of sync if you are downmixing audio and you interrupt things by seeking, in either direction).

Fixing the root issues would be preferrable but seems difficult and, until then, having the option to force burn-in would really help

@ppp7032

This comment was marked as off-topic.

@GertSallaerts
Copy link
Copy Markdown
Contributor Author

Hey @nielsvanvelzen, this PR has a merge conflict and I'd rather not rebase if the answer is going to be no, so I'm checking in.

I've done some more testing and research since we last spoke:

This is an opt-in toggle. Users who don't need it won't be affected, and users who do currently have no way to get working subtitles during transcoding on Android TV.

Are you open to merging this, or should I close it?

@nielsvanvelzen
Copy link
Copy Markdown
Member

Ok after reconsidering I'm still not the biggest fan of this as it will prevent the subtitle customization from working. But I also understand that some people would be fine with that trade off when it "solves" the synchronization issue. Therefor I think it's fine to add a setting for this in the advanced playback preferences with at least a heads up about it ignoring the customization options in the description.

@GertSallaerts GertSallaerts force-pushed the feat/always-burn-subs-transcode branch from c27be2c to fc29be3 Compare March 31, 2026 20:01
@jellyfin-bot jellyfin-bot removed the merge conflict Conflicts prevent merging label Mar 31, 2026
Comment thread app/src/main/java/org/jellyfin/androidtv/preference/UserPreferences.kt Outdated
Comment thread app/src/main/java/org/jellyfin/androidtv/ui/playback/PlaybackManager.kt Outdated
@GertSallaerts GertSallaerts force-pushed the feat/always-burn-subs-transcode branch from fc29be3 to ee68537 Compare April 4, 2026 15:16
Copy link
Copy Markdown
Contributor Author

@GertSallaerts GertSallaerts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @nielsvanvelzen I wasn't done with my changes when you reviewed them, committed and pushed my pending code when I finished for the day. Ready now and took care of the comments you already left.

Comment thread app/src/main/java/org/jellyfin/androidtv/preference/UserPreferences.kt Outdated
Comment thread app/src/main/java/org/jellyfin/androidtv/ui/playback/PlaybackManager.kt Outdated

// The server does not update the subtitle delivery method when alwaysBurnInSubtitleWhenTranscoding
// is set, so we need to assume subs are burned in when transcoding with the option enabled.
protected boolean shouldBurnInSubtitles(PlayMethod playMethod) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
@jellyfin-bot jellyfin-bot added the merge conflict Conflicts prevent merging label Apr 5, 2026
@nielsvanvelzen
Copy link
Copy Markdown
Member

@GertSallaerts if you can fix the merge conflicts we can go ahead and merge this.

@GertSallaerts GertSallaerts force-pushed the feat/always-burn-subs-transcode branch from ee68537 to 67d896b Compare April 20, 2026 18:13
@jellyfin-bot jellyfin-bot removed the merge conflict Conflicts prevent merging label Apr 20, 2026
@GertSallaerts
Copy link
Copy Markdown
Contributor Author

@nielsvanvelzen rebased on the master branch

@nielsvanvelzen nielsvanvelzen added this to the v0.20.0 milestone Apr 20, 2026
@nielsvanvelzen nielsvanvelzen added the enhancement New feature or request label Apr 20, 2026
@nielsvanvelzen nielsvanvelzen merged commit 65707c1 into jellyfin:master Apr 20, 2026
4 checks passed
@nielsvanvelzen
Copy link
Copy Markdown
Member

Thanks for working on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

subtitle out of sync when transcoding

8 participants